﻿<Page
    x:Class="AnimationsExample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AnimationsExample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.Triggers>
            <EventTrigger RoutedEvent="Grid.Loaded">
                <BeginStoryboard>
                    <Storyboard TargetName="MainEllipse">
                        <DoubleAnimation From="10"                                  
                                    To="-10" 
                                    Duration="0:0:1"
                                    AutoReverse="True"
                                    RepeatBehavior="Forever"
                                    Storyboard.TargetProperty="(FrameworkElement.RenderTransform).(TranslateTransform.Y)">
                            <DoubleAnimation.EasingFunction>
                                <BounceEase Bounces="3" EasingMode="EaseIn"></BounceEase>
                            </DoubleAnimation.EasingFunction>
                        </DoubleAnimation>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Grid.Triggers>
        <Grid.Resources>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal">
            <ComboBox x:Name="Animations" 
                      Width="200"
                      DisplayMemberPath="Description" Margin="5" SelectionChanged="Animations_OnSelectionChanged"></ComboBox>
            <Button x:Name="BtnBegin" Content="Begin" Click="BtnBegin_OnClick" Margin="5"></Button>
            <Button x:Name="BtnEnd" Content="End" Click="BtnEnd_OnClick" Margin="5"></Button>
        </StackPanel>
        <Ellipse x:Name="MainEllipse"
            Grid.Row="1" Width="100" Height="100" HorizontalAlignment="Left"
                 Stroke="Blue" StrokeThickness="5" Fill="Yellow">
            <Ellipse.RenderTransform>
                <TranslateTransform X="0" Y="0"></TranslateTransform>
            </Ellipse.RenderTransform>
        </Ellipse>
    </Grid>
</Page>
